import { reactive } from 'vue'
import { getPurchaseOrderPageList, getTaskPageList, updateDataStatus } from '@/api/task/task-piblish'
import { getOptionList } from '@/api/base/brand'
import { getWarehouseOptionList } from '@/api/base/warehouse'
import { getTageOptionLList } from '@/api/base/tag'
import { getStoreOptionsList } from '@/api/base/shop'

export function useDetail() {
  const status = reactive({
    saving: false,
    loading: false
  })

  const finishTask = async (code: any, status: any) => {
    return updateDataStatus(code, status)
  }
  const getDataList = async (data: any) => {
    return getTaskPageList(data)
  }

  const getBrandOptions = async (type: any) => {
    return getOptionList(type)
  }

  // 获取仓库列表
  const getWarehouseList = async () => {
    return getWarehouseOptionList()
  }

  // 获取门店列表
  const getStoreOptions = async () => {
    return getStoreOptionsList()
  }

  // 获取标签列表
  const getTagList = async () => {
    return getTageOptionLList()
  }

  return {
    status,
    getDataList,
    getBrandOptions,
    getWarehouseList,
    getStoreOptions,
    getTagList,
    finishTask
  }
}
